﻿#ifndef HOTELPLATFORMCLIENT_H
#define HOTELPLATFORMCLIENT_H

#include <QMainWindow>
#include "userhomepage.h"
#include "loginform.h"
#include "msgsocket.h"
#include "globalvars.h"
#include "searchhotel.h"
#include "collectionlist.h"
#include "orderformlist.h"
#include "hoteldetails.h"
#include "contactcustomerservice.h"
#include "settingoperate.h"
#include "hotelmanage.h"
#include "ordermanagebus.h"
#include "commentmanage.h"
#include "ordercenter.h"
#include "certificatecenter.h"


namespace Ui {
class HotelPlatformClient;
}

class HotelPlatformClient : public QMainWindow
{
    Q_OBJECT

public:
    explicit HotelPlatformClient(QWidget *parent = nullptr);
    ~HotelPlatformClient();

    void initWindows();
    void initUserShow();
    void initWorkerShow();
    void initBusinessManShow();
    void connectSignalsAndSlots();
    void connectComSignalsAndSlots();
    void connectSignalsSlotsForUser();
    void connectSignalsSlotsForBusiness();

    void GainOrederFormList();
    void GainSaveList();

    void gainHotelManageIdAndName();
public slots:
    void slotUserRegisterLogin(QStringList parameters);
    void slotUserLogin(QStringList parameters);

    void slotErrorInterNet();
    void slotUserLogout(int type);
    void slotUserLogoutResult(bool result);
    void slotUserLoginResult(bool result, QString msg);
    void slotUserRegisterResult(bool result, QString msg);
    void slotGainUserInfoResult(bool result, QString msg);
    void slotUploadCertImageSchedule();
    void slotModifyUserInfosResult(bool result, QString msg);
    void slotModifyPasswordResult(bool result, QString msg);
    void slotUploadCertificateResult(bool result, QString msg);
    void slotModifyHeadPic(const QString &path);
    void slotUpdateUserInfos(const QStringList& msgList);
    void slotModifyPassword(QString oldPwd, QString newPwd);

    /// hotel
    void slotGainHotelInfoListSocket(QString msg);

    /// reserve
    void slotSubmitReserve();
    void slotGainReserveDetails(const QString&reserveID);
    void slotDeleteReserve(const QString&reserveID);

    /// comment
    void slotCommentSubmit();
    void slotSubmitCommentImage(const QStringList&pathList);

    /// save
    void slotGainHotelDetails(const QString&hotelID);
    void slotSubmitSaveHotel(bool isSave);
    void slotDeleteSaveHotel(const QString&hotelID);

    ///download image
    void slotUserImageResult(bool result,const QImage&image);

    //////////////////////////////business/////////////////////////////
    void slotGainHotelManageList();
    void slotBusinessManCertificate(const QString& realName,const QStringList &imageList);

    void slotDeleteHotelInfo(const QString &hotelID);
    void slotDeleteHouseInfo(const QString &houseID);
    void slotSubmitHotelInfo();
    void slotSubmitHouseInfo();

    ///**orderManage**///
    void slotGainOrderManageList(const QString &hotelID);
    void slotModifyOrderState(const QString &reserveID, const QString &state);

    ///**commentManage**///
    void slotSubmitBusComment(const QString &commentID, const QString &comment);
    void slotGainHotelCommentList(const QString &index, const QString &commentID);


    //////////////////////////////worker/////////////////////////////
    void connectSignalsSlotsForWorker();
    void slotGainOrderAllList();
    void slotGainCertAllList(int index);
    void slotHotelPassCert(bool result, const QString &hotelID);
    void slotPassCertResult(bool result, const QString &userID);

private slots:
    void on_actionMycenter_triggered();
    void on_actionfindHotel_triggered();
    void on_actionorderForm_triggered();
    void on_actionsaveCenter_triggered();
    void slotSetHotelDetails(bool result,const QString& msg);

    void on_actionlogout_triggered();
    void on_actioncustomer_triggered();
    void on_actionSetting_triggered();
    void on_actionhotelManage_triggered();

    void on_actionorderFormList_triggered();
    void on_actioncommentManage_triggered();
    void on_actioncertCenter_triggered();
    void on_actionorderCenter_triggered();

protected:
    void closeEvent(QCloseEvent *ev);

private:
    Ui::HotelPlatformClient *ui;

    bool m_isLogOut;
    bool m_isCloseSystem;

    SettingOperate *m_oper;
    LoginForm *m_loginForm;
    MsgSocket *m_msgSocket;
    UserHomePage *m_userHomePage;
    ContactCustomerService *m_contactService;

    SearchHotel *m_searchHotel;
    CollectionList *m_collectionList;
    OrderFormList *m_orderFormList;
    HotelDetails *m_hotelDetails;

    HotelManage *m_hotelManage;
    OrderManageBus *m_orderManage;
    CommentManage *m_commentManage;

    OrderCenter *m_orderCenter;
    CertificateCenter *m_certCenter;
};

#endif // HOTELPLATFORMCLIENT_H
